﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.DynamicProxy;

namespace DevFx.FrameWork.Core
{
    public static class InstanceHelper
    {
        private static ProxyGenerator proxyGenerator = new ProxyGenerator();
        private static IInterceptor intercepter = new InterceptorProxy();
        public static T CreateInstance<T>()
            where T : class
        {
            return proxyGenerator.CreateClassProxy(typeof(T), intercepter) as T;
        }
        public static T CreateInstance<T>(Type[] additionalInterfacesTypes)
           where T : class
        {

            return proxyGenerator.CreateClassProxy(typeof(T), additionalInterfacesTypes, intercepter) as T;
        }

    }
}
